﻿using System.Diagnostics;

namespace DimensionsHelper.LanguageService.Syntax;

public class MacroTokenPaster : SourceNode
{
    private readonly SourceNode _hashHashToken;
    private readonly SourceNode _left;
    private SourceNode _right;

    internal MacroTokenPaster(SourceNode? parent, SourceNode left, SourceNode hashHashToken) :
        base(parent, SyntaxKinds.MacroTokenPaster)
    {
        SetChildField(ref _left, left);
        SetChildField(ref _hashHashToken, hashHashToken);
        _right = Default;
    }


    public SourceNode Left => _left;

    public SourceNode Right => _right;


    internal MacroTokenPaster Update(SourceNode rightNode)
    {
        SetChildField(ref _right, rightNode);
        return this;
    }


    internal MacroTokenPaster Update(MacroTokenPaster rightPaster)
    {
        SetChildField(ref _right, rightPaster);
        return this;
    }
}


public static partial class NodeFactory
{
    public static MacroTokenPaster CreateMacroTokenPaster(SourceNode? parent, SourceNode left,
        SourceNode hashHashToken)
    {
        Debug.Assert(left.IsIdentifier);
        Debug.Assert(hashHashToken.IsNode(SyntaxKinds.HashHashToken));
        return new MacroTokenPaster(parent, left, hashHashToken);
    }
}